﻿package  {
	import flash.geom.Point;
	
	public class Horse extends Piece
	{

		public var pieceName:String = "horse";
		
		public function Horse(pieceColor:String, currentRow:int, currentColumn:int, firstMove:Boolean=false) 
		{
			this.firstMove = firstMove;
			super(pieceColor, currentRow, currentColumn);
		}
		
		public function moves(board:Array, enPassantPawn:Object):Array
		{
			positions = new Array();
			
			for (var i:int = -2; i <= 2; i++) 
			{
				for (var j:int = -2; j <= 2; j++) 
				{
					if ( (i * j == 2) || (i * j == -2) ) 
					{
						if ((this.row + i > 7) || (this.row + i < 0) || (this.column + j > 7) || (this.column + j < 0)) 
						{
						} 
						else if( board[this.row + i][this.column +j] == null ||
								 board[this.row + i][this.column +j].pieceColor != this.pieceColor)
						{
							positions.push( new Point((this.row + i), (this.column + j)));
						}
					}
				}
			}
			
			return positions;
		}

	}
	
}
